// List<LinkInfo>
import 'package:private_journey/pages/trending.dart';
import 'package:signals/signals_flutter.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart' as shadcn;

var linkInfos = Signal<List<LinkInfo>>([]);
var currentLinkIcon = Signal<String>('');
var userBackGroundImage = Signal<String>('');
var currentColorScheme = Signal<shadcn.ColorScheme>(
  shadcn.ColorSchemes.lightRose(),
);
var hitokoto = Signal<String>('');
var currentSearchEngine = Signal<String>('Bing');
var currentTimeHour = Signal<int>(0);
var currentTimeMinute = Signal<int>(0);
var currentTimeSecond = Signal<int>(0);
var keyMap = Signal<Map<KeyCodeInfo, int>>({});
var keyCodeInfo = Signal(KeyCodeInfo('', -1));
var keyCodeInfos = Signal<List<KeyCodeInfo>>([]);
var currentKeys = Signal<List<KeyCodeInfo>>([]);
bool isInKeyboardPage = false;

enum KeyState { pressed, released }

class KeyCodeInfo {
  String key;
  int code;
  KeyState state;

  KeyCodeInfo(this.key, this.code, {this.state = KeyState.released});

  @override
  String toString() {
    return 'KeyCodeInfo{key: $key, code: $code, state: $state}';
  }

  @override
  int get hashCode => key.hashCode ^ code.hashCode;

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    return other is KeyCodeInfo && other.code == code;
  }
}
